<template>
      <div class="f-lover" style="background: #fbfaf9;">
        <!--内容开始-->
        <div class="fl-container">
            <!--标题也即分类-->
            <div class="hd">
              <a href="" class="more">更多鲜花<span class="el-icon-arrow-right"></span></a>
              <h3>
                <a>花之物语</a>
                <span>送 · 为你怦然心动的人</span>
              </h3>
            </div>
            <!--背景和图片-->
            <div class="bd">
            <!--左侧大图-->
              <div class="bd-l">
                <div class="banner-box">
                  <a @click=" "><img src="http://lixinghe.meimeng.eu.org/flower/image/%E5%88%9D%E9%9F%B3%E6%9C%AA%E6%9D%A5.jpg"  style="width: 288px;height: 656px" alt=""></a>
                  <div class="link-cover">
                    <a>鲜花专区<el-icon><ArrowRightBold /></el-icon></a>
                  </div>
                </div>
              </div>
            <!--右边详细分类-->
              <div class="fl-products">
                <div class="fl-products-item" v-for="(item,index) in goodsData">
                  <a @click="goTo('goodsdetail')">
                    <div class="img-box" href="">
                      <img height="240" width="220" :src="item.imgsrc"  style="display: inline;">
                    </div>
                    <div class="product-content">
                      <p class="product-title">{{item.title}}</p>
                      <p class="product-price">
                        <span class="price-sign">¥{{item.price}}</span>
                        <span class="primeCost">￥{{item.primeCost}}</span>
                      </p>
                      <p class="product-sell">已售 {{item.sold}} 件</p>
                    </div>
                  </a>
                </div>
              </div>
            </div>
        </div>
        <!--内容结束-->
      </div>
</template>

<script>
import {reactive, toRefs} from "vue";

  export default {
    name: "GoodsHome",
    setup(){
      let data = reactive({
        goodsData: [
          {
            title:'冬日暖阳',
            imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
            price:'99',
            primeCost:'999',
            sold:100
          },
          {
            title:'冬日暖阳',
            imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
            price:'99',
            primeCost:'999',
            sold:100
          },
          {
            title:'冬日暖阳',
            imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
            price:'99',
            primeCost:'999',
            sold:100
          },
          {
            title:'冬日暖阳',
            imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
            price:'99',
            primeCost:'999',
            sold:100
          },
          {
            title:'冬日暖阳',
            imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
            price:'99',
            primeCost:'999',
            sold:100
          },
          {
            title:'冬日暖阳',
            imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
            price:'99',
            primeCost:'999',
            sold:100
          },
          {
            title:'冬日暖阳',
            imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
            price:'99',
            primeCost:'999',
            sold:100
          },
          {
            title:'冬日暖阳',
            imgsrc:'http://lixinghe.meimeng.eu.org/flower/image/20141006231606_CrJmu.jpeg',
            price:'99',
            primeCost:'999',
            sold:100
          },
        ]
      })

      return {
        ...toRefs(data)
      }
    }
  }
</script>

<style scoped lang="scss">
  * {
    padding: 0;
    margin: 0;
    border: 0;
  }
  a {
    text-decoration: none;
    cursor: pointer;
  }
  .f-lover {
    width: 100%;
  }
  .fl-container {
    border-radius: 10px;
    box-shadow: rgba(0 ,0 ,0 ,0.2) 0px 4px 8px 0px, rgba(0, 0 ,0 ,0.2) 0px 6px 20px 0px;
    width: 1200px;
    margin: 0 auto;
    margin-top: 30px;
    padding: 40px 20px 20px 20px;
    .hd {

      .more {
        font-size: 14px;
        line-height: 30px;
        color: #71797F;
        float: right;
      }
      h3 {
        width: 341px;
        font-size: 26px;
        line-height: 30px;
        font-weight: bold;
        a {
          color: #232628;
          &:hover {
            color: orange;
          }
        }
        span {
          padding-left: 15px;
          margin-left: 16px;
          font-size: 20px;
          line-height: 24px;
          font-weight: normal;
          border-left: 1px solid #71797F;
        }
      }
    }
    .bd {
      margin-top: 14px;
      display: flex;
      justify-content: space-evenly;
      font-size: 0;
    }
  }
  .banner-box {
    position: relative;
  }
  .fl-products {
    display: flex;
    flex-flow: wrap;
    justify-content: space-evenly;
    width: 900px;
    vertical-align: top;
    height: 670px;
    .bd-l {
      display: inline-block;
      width: 288px;
      vertical-align: top;
      .link-cover {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        height: 160px;
        background: url("http://lixinghe.meimeng.eu.org/flower/image/home_linkcover.png");
        a {
          display: block;
          width: 240px;
          height: 60px;
          margin: 74px auto 0;
          border: 2px solid rgba(255,255,255,0.7);
          font-size: 22px;
          line-height: 56px;
          color: #fff;
          font-weight: bold;
          text-align: center;
        }
      }
    }
    .fl-products-item {
      display: inline-block;
      border-radius: 10px;
      width: 212px;
      margin-bottom: 16px;
      background-color: #fff;
      vertical-align: top;
      border:1px solid #e3d5d5;
      &:hover {
        transition: all 0.3s linear;
        box-shadow:0 0 20px #cccccc;
      }
      .img-box {
        width: 100%;
        height: 228px;
        overflow: hidden;
        cursor: pointer;
        img {
          width: 100%;
          max-width: 100%;
          height: auto;
          vertical-align: bottom;
          text-decoration: none;
        }
      }
      .product-content {
        padding: 10px 8px 14px;
        text-align: center;
        color: #232628;
      }
      &:hover .product-content p{
        color: orange;
      }
      .product-title {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 16px;
        line-height: 20px;
      }
      .product-price {
        margin-top: 5px;
        font-size: 16px;
        font-weight: bold;
        line-height: 20px;
      }
      .product-sell {
        margin-top: 6px;
        font-size: 12px;
        color: #71797F;
        line-height: 16px;
      }
    }
  }
  .primeCost {
    font-size: 14px;
    font-weight: normal;
    margin-left: 10px;
    color: #e5e5e5;
    text-decoration: line-through;
  }
</style>
